<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script language="javascript" type="text/javascript" src="/assets/libs/fastadmin-layer/dist/layer.js"></script>
<script src="/ueditor/ueditor.config.js"></script>
<script src="/ueditor/ueditor.all.min.js"></script>
<script src="/ueditor/lang/zh-cn/zh-cn.js"></script>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="" enctype="multipart/form-data">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">标题:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" class="form-control" name="title" type="text" value="{$res.s_name}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">广告链接:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-linkto" class="form-control" name="linkto" type="text" value="{$url}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">媒体类型:</label>
        <div class="col-xs-12 col-sm-8">
            <input  name="mtype"  value="0" type="radio" checked="checked">图片
            <input  name="mtype"  value="1" type="radio">视频
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">标题2:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title2" class="form-control" name="title2" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">图片上传:</label>
        <div class="col-xs-12 col-sm-8">
            <img src="" alt="" id="lod_pic"  width="200">
            <input id="imgurl"  name="imgurl" type="hidden">
            <button type="button" onclick="img_sub();" style="display:block;">确定</button>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">广告文字详情:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="info" name="info"></textarea>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="button" class="btn btn-success btn-embossed" onclick="sub();">添加</button>
            <a  href="/admin/adsense/index_ad?id={$sense_id}" class="btn btn-default btn-embossed">返回</a>
        </div>
    </div>
</form>

<script>

    function img_sub() {
        var tr_id="{$resAd['width']}";
        var tri_id="{$resAd['height']}";
        var p_id="lod_pic";
        var flag=0;
        var url="/add_img.php?p_id="+p_id+"&tr_id="+tr_id+"&tri_id="+tri_id+"&flag="+flag;
        //alert(url);
        layer.open({
            type: 2,
            title:"图片裁切",
            shift: 2,
            area: ['100%', '100%'],
            //shadeClose: true,
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条
        });
    }

    function sub() {
        var title=$("#c-title").val();
        if(title==''){
            alert("标题不得为空");
            return;
        }
        var url=$("#lod_pic").attr("src");
        $("#imgurl").val(url);
        $("#add-form").submit();

    }
</script>

<script type="text/javascript">
    UE.getEditor('info', {
        theme:"default", //皮肤
        lang:"zh-cn", //语言
        initialFrameWidth:1078,  //初始化编辑器宽度,默认800
        initialFrameHeight:320//  初始化编辑器高度
    });
</script>